package com.jia.leetCode;

/**
 * @program: Leetcode
 * @description:
 * @author: STU756
 * @create: 2020-08-19 13:37
 */
public class Pro0263 {
    public boolean isUgly2(int num) {
        if(num < 1) return false;
        while(num % 2 ==0) num /= 2;
        while(num % 3 ==0) num /= 3;
        while(num % 5 ==0) num /=5;
        return(num == 1)? true:false;
    }
    public boolean isUgly(int num) {
        int[] array = {2, 3, 5};
        for(int a : array) {
            while(num > 0 && num % a == 0) {
                num /= a;
            }
        }
        return num == 1;
    }
}
